
<style>
    .table{
        border: 1px solid #333;
        overflow: hidden;
        height: 85vh;
    }
    .table > thead > tr > th{
        border: 1px solid #333;
    }
    .table td, .table th{
        border: 1px solid #333;
    }
</style>
<div class="panel-body">
    <div id="myTabContent" class="tab-content">
        <!--@formatter:off-->

        <div class="widget-body no-padding">
            <form id="a1-form" class="edit-form form-horizontal" role="form" data-toggle="validator" method="POST" action="{:url('home.working/edit')}">
                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th width="8%"></th>
                        <th width="12%">{$week.0.str}</th>
                        <th width="12%">{$week.1.str}</th>
                        <th width="12%">{$week.2.str}</th>
                        <th width="12%">{$week.3.str}</th>
                        <th width="12%">{$week.4.str}</th>
                        <th width="12%">{$week.5.str}</th>
                        <th width="12%">{$week.6.str}</th>
                    </tr>
                    </thead>
                    <tbody>


                    {foreach $data as $index=>$vo}
                    <tr>
                        <td>
                            {if condition="$index=='1'"}09:00-10:00
                            {elseif condition="$index=='2'"}10:00-11:00
                            {elseif condition="$index=='3'"}11:00-12:00
                            {elseif condition="$index=='4'"}14:00-15:00
                            {elseif condition="$index=='5'"}15:00-16:00
                            {elseif condition="$index=='6'"}16:00-17:00
                            {/if}
                        </td>

                        {foreach vo.0 as $in=>$v}
                        <td class="tdClick">
                            <input type="hidden" name="ids" value="{$v.ids}">
                            <input type="hidden" name="time" value="{$index}">
                            <input type="hidden" name="date" value="{$v.date}">
                            <input type="hidden" name="idss" value='{$v.idss}'>
                            {$v.name}
                        </td>
                        {/foreach}

                    </tr>
                    {/foreach}


                    </tbody>
                    <!--<tfoot>-->
                    <!--<tr>-->
                        <!--<td></td>-->
                        <!--<td>-->

                        <!--</td>-->
                        <!--<td></td>-->
                        <!--<td></td>-->
                    <!--</tr>-->
                    <!--</tfoot>-->
                </table>
                <!--<div style="display: flex;justify-content: center">-->
                    <!--<button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button>-->
                    <!--<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>-->
                <!--</div>-->
            </form>
        </div>
        <!--@formatter:on-->
    </div>
</div>
<script src="/assets/img/jquery-3.4.1.min.js"></script>
<script>
    $('.tdClick').click(function(){
        let a = $(this).text();
        let b = $(this).children("input[name='ids']").val();
        let c = $(this).children("input[name='time']").val();
        let d = $(this).children("input[name='date']").val();
        let f = $(this).children("input[name='idss']").val();
        let ff = encodeURI(f);;
        let tims = {$time};

        if (c == 1){
            var t = '10:00';
        }else if(c == 2){
            var t = '11:00';
        }else if(c == 3){
            var t = '12:00';
        }else if(c == 4){
            var t = '15:00';
        }else if(c == 5){
            var t = '16:00';
        }else if(c == 6){
            var t = '17:00';
        }
        let tim = d+' '+t;
        var date = new Date(tim);
        //var date = new Date();
        // 有三种方式获取
        //var time1 = date.getTime();
        var time1 = Math.round(date/1000);
        //console.log(a.trim());
        //console.log(b);
        //console.log(c);
        //console.log(d);
        //console.log(ff);
        //console.log(c);
        //console.log(d);
       if (time1 < tims){
           layer.alert('时间已过期');
       }else {
           var url = 'home/working/edit?ids='+b+'&time='+c+'&date='+d+'&idss='+ff;
           Fast.api.opens(url, $(this).data("original-title") || $(this).attr("title") || __('选择专家'), $(this).data() || {});
       }

    })
</script>
